class ImageVideoDetailEntity {
  final String? id;
  final String? content;
  final String? cover;
  final String? userId;
  final String? categoryId;
  final String? categoryName;
  final String? categoryPid;
  final String? categoryPName;
  final String? otherUserId;
  final Album? album;
  final String? albumName;
  final int? imgCount;
  final int? status;
   String? avatar;
  final String? username;
  final List<String>? imgsUrl;
  final int? count;
  final List<TagList>? tagList;
  final String? viewCount;
   String? agreeCount;
  final String? collectionCount;
  final String? commentCount;
  final String? time;

  ImageVideoDetailEntity({
    this.id,
    this.content,
    this.cover,
    this.userId,
    this.categoryId,
    this.categoryName,
    this.categoryPid,
    this.categoryPName,
    this.otherUserId,
    this.album,
    this.albumName,
    this.imgCount,
    this.status,
    this.avatar,
    this.username,
    this.imgsUrl,
    this.count,
    this.tagList,
    this.viewCount,
    this.agreeCount,
    this.collectionCount,
    this.commentCount,
    this.time,
  });

  factory ImageVideoDetailEntity.fromJson(Map<String, dynamic> json) {
    return ImageVideoDetailEntity(
      id: json['data']['id'],
      content: json['data']['content'],
      cover: json['data']['cover'],
      userId: json['data']['userId'],
      categoryId: json['data']['categoryId'],
      categoryName: json['data']['categoryName'],
      categoryPid: json['data']['categoryPid'],
      categoryPName: json['data']['categoryPName'],
      otherUserId: json['data']['otherUserId'],
      album: json['data']['album'] == null ? null : Album.fromJson(json['data']['album']),
      albumName: json['data']['albumName'],
      imgCount: json['data']['imgCount'],
      status: json['data']['status'],
      avatar: json['data']['avatar'],
      username: json['data']['username'],
      imgsUrl: json['data']['imgsUrl'].cast<String>(),
      count: json['data']['count'],
      tagList: json['data']['tagList']?.map<TagList>((tag) => TagList.fromJson(tag)).toList(),
      viewCount: json['data']['viewCount'],
      agreeCount: json['data']['agreeCount'],
      collectionCount: json['data']['collectionCount'],
      commentCount: json['data']['commentCount'],
      time: json['data']['time'],
    );
  }

  void setAvatar(String avatar1) {
    this.avatar = avatar1;
  }
}

class Album {
  final String? id;
  final String? creator;
  final int? createDate;
  final String? name;
  final String? uid;
  final String? cover;
  final int? sort;
  final String? imgCount;
  final String? collectionCount;
  final String? updater;
  final int? updateDate;

  Album({
    required this.id,
    required this.creator,
    required this.createDate,
    required this.name,
    required this.uid,
    required this.cover,
    this.sort,
    this.imgCount,
    this.collectionCount,
    this.updater,
    this.updateDate,
  });

  factory Album.fromJson(Map<String, dynamic> json) {
    return Album(
        id: json['id'],
        creator: json['creator'],
        createDate: json['createDate'],
        name: json['name'],
        uid: json['uid'],
        cover: json['cover'],
      sort: json['sort']?.toInt(),
      imgCount: json['imgCount'],
      collectionCount: json['collectionCount'],
      updater: json['updater'],
      updateDate: json['updateDate']?.toInt(),
    );
  }
}

class TagList {
  final String? id;
  final String? creator;
  final int? createDate;
  final String? count;
  final String? name;
  final int? sort;

  TagList({
    required this.id,
    required this.creator,
    required this.createDate,
    required this.count,
    required this.name,
    this.sort,
  });

  factory TagList.fromJson(Map<String, dynamic> json) {
    return TagList(
      id: json['id'],
      creator: json['creator'],
      createDate: json['createDate'],
      count: json['count'],
      name: json['name'],
      sort: json['sort']?.toInt(),
    );
  }
}
